Skip to content

Conversation

@mfahampshire
Copy link
Contributor

@mfahampshire mfahampshire commented Dec 4, 2025

This PR makes the necessary modifications to be able to publish the majority of the Nym monorepo workspace crates to https://crates.io (essentially everything aside from binaries, internal tools, and a few select other things).

Overall, this PR:

  • defines a workspace version for these crates; we want to keep them all in line with each other, even if that means bumping versions frequently and when there hasn't necessarily been a change in all crates.
    adds a script to use cargo release to publish the SDK + its dependencies - cargo release deals with creating them in the correct order
  • excludes crates we dont want to publish via each crates' cargo.toml file
  • adds a global version definition for crates in the root cargo.toml
  • changes most imports from path to using the workspace version

Todo:

  • fix issues re git crates
    • bls crate: upload fork to crates.io
    • merge Upgrade to def_guard_wireguard v0.8.0 #6315 branch to make sure that there is no issue with new clients/gws and legacy ones after the dependency upgrade. If all good, change git import to 0.8.0 from crates as per PR Testing has been done on a NymVPN instance that was compiled with the new dependency interacting with mainnet gateways. The reverse situation will be tested by QA.
  • checkin on 'max todo' descriptions
  • experiment: remove separate contracts/ workspace - TEMP in max/crates-io-prep-v2-contract-experiment EDIT: publish crates then just use crates.io imports for contracts/
  • fix nym-credential-verification compilation errs in dryrun
  • add publishing.md writeup

This change is Reviewable

@vercel
Copy link

vercel bot commented Dec 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
nym-explorer-v2 Ready Ready Preview, Comment Jan 19, 2026 10:57am
2 Skipped Deployments
Project Deployment Review Updated (UTC)
docs-nextra Ignored Ignored Preview Jan 19, 2026 10:57am
nym-node-status Ignored Ignored Preview Jan 19, 2026 10:57am

Request Review

Cargo.toml Outdated

# sdk related deps so we can pull in workspace versions of these in other crates' cargo files, and not have to define the version everywhere
# nym-api = { version = "1.2.0", path = "nym-api" }
nym-bandwidth-controller = { version = "1.2.0", path = "common/bandwidth-controller" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure you have to specify the version on top here (plz double check), but if not, i'd remove it so we wouldn't cause some inconsistencies if we forget to update those

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the hacky way I found which allows us to define the workspace.version for the constituent crates. Maybe I can get rid of those.. Will experiment.

Copy link
Contributor Author

@mfahampshire mfahampshire Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we have to keep the top level version - but cargo workspaces should keep it all in line

[package]
name = "sqlx-pool-guard"
version = "0.1.0"
name = "nym-sqlx-pool-guard"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since you've renamed this, after the PR gets merged, create a draft on the vpn repo to update their dependencies (as they were importing it too)

Copy link
Contributor Author

@mfahampshire mfahampshire Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note to self - check where this occurs elsewhere Looks like that was the only spot.

PR created, in draft until this PR is merged.

@mfahampshire mfahampshire force-pushed the max/crates-io-prep-v2 branch from d07d3ad to 712ad35 Compare January 5, 2026 11:05
@vercel vercel bot temporarily deployed to Preview – nym-explorer-v2 January 7, 2026 10:24 Inactive
@mfahampshire mfahampshire force-pushed the max/crates-io-prep-v2 branch from f7df17e to aea7607 Compare January 8, 2026 15:26
on:
workflow_dispatch:
inputs:
version:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this require a separate validation or cargo workspaces handles it properly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my understanding, crates.io would reject the upload if e.g. someone fat-fingered the release version to a previous version, or something like that.

What other validation were you thinking of?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can add validation to make the version is properly formatted etc

prometheus = { version = "0.14.0" }

# Workspace dep definitions required by crates.io publication - we need a workspace version since `cargo workspaces` doesn't work with path imports from crate manifests
nym-api-requests = { version = "1.20.1", path = "nym-api/nym-api-requests" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you don't have to specify version in here, since workspace already has it and workspace crates take it from workspace.package.version anyway.

It's enough to leave path = .. in here and remove duplicate version definitions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need it for cargo workspaces, otherwise when we try and publish we get errors like this:

error: failed to verify manifest at `/home/m/dev/work/nym/common/cosmwasm-smart-contracts/coconut-dkg/Cargo.toml`

Caused by:
  all dependencies must have a version requirement specified when publishing.
  dependency `nym-contracts-common` does not specify a version
  Note: The published dependency will use the version from crates.io,
  the `path` specification will be removed from the dependency declaration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants